/***********************************************************************************
@file   
@author
@attention
@index
***********************************************************************************/
#ifndef __SLEEP_H__
#define __SLEEP_H__
/* Private includes ----------------------------------------------------------*/
#include "main.h"
/* Private define ------------------------------------------------------------*/
#define IR_WAKEUP_TIME    1000   //红外唤醒后运行时间
#define SPAN_WAKEUP_TIME  18000  //标定界面最大时间3min
#define IR_NORMAL_TIME    2000   //红外正常操作后运行时间
#define POWER_WAKEUP_TIME 2000   //设备启动预热后运行时间
#define RTC_WAKEUP_TIME   20     //RTC唤醒后运行时间
#define BUT_WAKEUP_TIME   1500   //按键唤醒后运行时间
/* Private typedef -----------------------------------------------------------*/

/* Private variables ---------------------------------------------------------*/
typedef struct {
uint8_t  last_fsm_state;//执行状态指示      
uint8_t  now_fsm_state;//执行状态指示    
   
//uint8_t  ir_state;     //空中唤醒  
//uint8_t  ir_flag;  
    
uint8_t  tim_flag;     //设备运行定时器
uint16_t tim_cnt;  
    
uint32_t sensor_cnt;   //传感器工作时间定时器
}_sleep_obj;
extern _sleep_obj sleep_obj;
/* Private function ----------------------------------------------------------*/
extern void sleep_exe_fsm(uint8_t state);	
extern void sleep_tim_fsm(uint8_t state);


extern void sleep_timer(void);
extern void sleep_device_operation_time(uint32_t cnt);
extern void sleep_sensor_operation_time(uint32_t cnt);
extern void sleep_device_update_time(uint32_t cnt);

extern void sleep_wakeup_run(void);
extern void sleep_update_state(uint8_t state);
extern void sleep_device_operation_time1(uint32_t cnt);
#endif




